import systemReducer, {SystemState} from "@/store/system";
import userReducer, {UserState} from "@/store/user";
import {configureStore} from "@reduxjs/toolkit";
import {useDispatch, useSelector} from "react-redux";

export const store = configureStore({
    reducer: {
        user: userReducer,
        system: systemReducer,
    },
});

type RootState = {
    user: UserState;
    system: SystemState;
};
type AppDispatch = typeof store.dispatch;

export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
export const useAppSelector = useSelector.withTypes<RootState>();
